<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="UTF-8">
  <title>Service test</title>
  <link rel="stylesheet" href="../../../node_modules/bootstrap/dist/css/bootstrap.min.css"/>
</head>
<body>

<div id="res" class="container-fluid">

  <div class="row-fluid">
    <div class="col-sm-12">
      <h3 class="page-header text-center">
        资源管理
        <small>{{modeTitle}} (Task Viewer)</small>
      </h3>
    </div>
  </div>

  <div class="row">
    <div class="col-sm-12">
      <div class="col-sm-3">
        <button class="btn btn-default" href="#add" v-on:click="setMode('modeAddNew')">新增</button>
        &nbsp;&nbsp;&nbsp;
        <a role="button" class="btn btn-default" data-toggle="collapse" href="#details"
           aria-expanded="false"
           aria-controls="details">详情</a>
      </div>
      <!-- <form id="search"> -->
      <div class="col-sm-offset-3 col-sm-3">
        <input id="searchQuery" name="query" type="text" style="float:right" v-model="searchQuery" class="form-control"
               required/>
      </div>
      <div class="col-sm-2">
        <button id='search' class="btn btn-outline btn-block btn-success save" v-on:click="basicsearch($event)"><strong>搜索全部</strong>
        </button>
      </div>
      <div class="col-sm-1 text-left vertical-middle-sm">
        <h5><strong>
          <a role="button" class="control-label" data-toggle="collapse" href="#advancedsearch" aria-expanded="false"
             aria-controls="advancedsearch">高级...</a>
        </strong></h5>
      </div>
      <!-- </form> -->
    </div>
  </div>

  <div class="row">
    <div class="col-sm-12">
      <br/>
    </div>
  </div>


  <div class="row">
    <div class="collapse col-sm-12" id="advancedsearch">
      <div class="well">
        <div class="row">
          <!-- <form class="form-horizontal contract-form"> -->
          <div class="form-group">
            <label class="col-sm-1 control-label">Begin Time</label>

            <div class="col-sm-5">
              <input id="begtime" name="begtime" type="text" v-model="begtime" value="2015-01-01" class="form-control"
                     required/>
            </div>
            <label class="col-sm-1 control-label">End Time</label>

            <div class="col-sm-5">
              <input id="endtime" name="endtime" type="text" v-model="endtime" value="2016-02-01"
                     class="form-control" required/>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-1 control-label">User Id</label>

            <div class="col-sm-5">
              <input id="user" name="user" type="text" v-model="user" value="" class="form-control" required/>
            </div>
          </div>
          <div class="form-group">
            <div class="col-sm-offset-9 col-sm-1">
              <button class="btn btn-outline btn-block btn-warning" type="reset">清除</button>
            </div>
            <div class="col-sm-2">
              <button id='submitbutton' class="btn btn-outline btn-block btn-success save"
                      v-on:click="advancedsearch($event)">提交
              </button>
            </div>
          </div>
          <!-- </form> -->
        </div>
      </div>
    </div>
    <!-- advancedsearch -->
  </div>

  <div class="row">
    <div class="row">
      <div class="collapse col-sm-12" id="details">
        <div class="well">
          <div class="row">
            <!-- <form class="form-horizontal contract-form"> -->
            <table class="table table-bordered table-condensed table-striped">
              <thead>
              <tr>
                <th>uuid</th>
                <th>level</th>
                <th>crtdate</th>
                <th>upddate</th>
                <th>crtuser</th>
                <th>upduser</th>
                <th>originname</th>
                <th>curname</th>
                <th>parent</th>
                <th>state</th>
                <th>properties</th>
              </tr>
              </thead>
              <tbody>
              <td>{{items2.uuid}}</td>
              <td>{{items2.level}}</td>
              <td>{{items2.crtdate}}</td>
              <td>{{items2.upddate}}</td>
              <td>{{items2.crtuser}}</td>
              <td>{{items2.upduser}}</td>
              <td>{{items2.originname}}</td>
              <td>{{items2.curname}}</td>
              <td>{{items2.parent}}</td>
              <td>{{items2.state}}</td>
              <td>{{items2.properties}}</td>
              </tbody>
            </table>
            <!-- </form> -->
          </div>
        </div>
      </div>
      <!-- details -->
    </div>
  </div>

  <div id="objectlist" v-show="mode=='modeList'">

    <div class="row">
      <div class="table-responsive col-sm-12">
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <button class="btn btn-default" data-toggle="collapse" aria-expanded="false" href="#backToParent"
                v-on:click="backToParent()">返回上一级
        </button>
        <ul class="media-list row contacts-container"></ul>
        <table class="table table-bordered table-condensed table-striped">
          <thead>
          <tr class="info">
            <th></th>
            <th>originname</th>
            <th>upduser</th>
            <th>upddate</th>
            <th>curname</th>
            <th>parent</th>
            <th>oper</th>
          </tr>
          </thead>
          <tbody>
          <tr v-for="item in items">
            <td><input type="checkbox" v-model="item.selected"></td>
            <td><a href="#" v-on:click="onChange(item)">{{item.originname}}</a>
              <ul class="media-list row contacts-container"></ul>
            </td>
            <td>{{item.upduser}}</td>
            <td>{{item.upddate}}</td>
            <td>{{item.curname}}</td>
            <td>{{item.parent}}</td>
            <td>
              <a href="#" v-on:click="onEdit(item,'modeEdit')">编辑</a>&nbsp;|
              <a href="#" v-on:click="onRemove(item)">删除</a>&nbsp;|
              <a href="#download" v-on:click="download(item)">下载</a>&nbsp;|
            </td>
          </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div><!--/modeList-->

  <div id="objectadd" v-show="mode=='modeAddNew'">
    <div class="row">
      <itemadd :mode="mode" :item="curitem" :on-submit="onSave" :on-cancel="onCancel"></itemadd>
    </div>
  </div>
  <!--/modeAddNew-->

  <div id="objecteditor" v-show="mode=='modeEdit'">
    <div class="row">
      <itemeditor :mode="mode" :item="curitem" :on-submit="onSave" :on-cancel="onCancel"></itemeditor>
    </div>
  </div>
  <!--/modeEdit-->

</div>

<!--/res-->

<template id="itemeditor-tpl">
  <div class="col-sm-12">
    <!--form begin-->
    <div class="form-horizontal">

      <div class="site-bgcolor">
        <hr/>

        <div class="form-group">
          <label for="upduser" class="col-sm-2 control-label">upduser</label>

          <div class="col-sm-4">
            <input class="form-control" id="upduser" name="upduser" placeholder="upduser" v-model="item.upduser">
          </div>
        </div>

        <div class="form-group">
          <label for="curname" class="col-sm-2 control-label">curname</label>

          <div class="col-sm-4">
            <input class="form-control" id="curname" name="curname" placeholder="curname" v-model="item.curname"/>
          </div>

        </div>

        <div class="form-group">
          <div class="col-sm-offset-2 col-sm-10">
            <button class="btn btn-default" v-on:click="onCancelClick($event)">取消</button>
            <button class="btn btn-default" v-on:click="onSubmitClick($event)">提交</button>
          </div>
        </div>

        <hr/>
      </div>

    </div>
    <!-- </form> -->
  </div>
</template>

<template id="itemadd-tpl">
  <div class="col-sm-12">
    <div class="form-horizontal">

      <div class="form-horizontal">
        <div class="site-bgcolor">
          <hr/>

          <div class="form-group">
            <label for="originname" class="col-sm-2 control-label">originname</label>

            <div class="col-sm-4">
              <input class="form-control" id="originname" name="originname" placeholder="文件名.后缀名"
                     v-model="item.originname">
            </div>
          </div>
          <div class="form-group">
            <label for="crtuser" class="col-sm-2 control-label">crtuser</label>

            <div class="col-sm-4">
              <input class="form-control" id="crtuser" name="crtuser" placeholder="crtuser" v-model="item.crtuser"/>
            </div>
          </div>
          <div class="form-group">
            <label for="upddate" class="col-sm-2 control-label">upddate</label>

            <div class="col-sm-4">
              <input class="form-control" id="upddate" name="upddate" placeholder="xxxx-xx-xx hh:mm:ss"
                     v-model="item.upddate"/>
            </div>
          </div>

          <form id="uploadForm" action="http://euvee.vicp.co/File" method="post"
                enctype="multipart/form-data" name="uploadForm">
            <div class="form-group">
              <label for="fileId2" class="col-sm-2 control-label">file</label>

              <div class="col-sm-4">
                <input class="form-control" id="fileId2" type="file" multiple name="file"
                       data-url="http://euvee.vicp.co/File"/>
              </div>
            </div>
            <!--            <div class="container" id="app">
                          &lt;!&ndash; only show the menu when ready &ndash;&gt;
                          <ul v-show="uploadedFiles.length > 0">
                            &lt;!&ndash; loop through the completed files &ndash;&gt;
                            <li v-for="file in uploadedFiles">Name: <em>{{ file.name }}</em> Size: <em>{{ file.size | prettyBytes }}</em></li>
                          </ul>
                          &lt;!&ndash; only show when ready, fileProgress is a percent &ndash;&gt;
                          <div class="progress-bar" style="width: {{ fileProgress }}%" v-show="fileProgress > 0" ></div>
                          &lt;!&ndash; message for all uploads completing &ndash;&gt;
                          <p v-if="allFilesUploaded"><strong>All Files Uploaded</strong></p>
                          &lt;!&ndash; full usage example &ndash;&gt;
                          <file-upload class="my-file-uploader" name="myFile" id="myCustomId" action="http://euvee.vicp.co/File" multiple>Inside Slot Text</file-upload>
                          &lt;!&ndash; minimal usage &ndash;&gt;
                          <file-upload name="anotherFile" action="http://euvee.vicp.co/File"></file-upload>
                        </div>-->
          </form>
          <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
              <button class="btn btn-default" v-on:click="onCancelClick($event)">取消</button>
              <button class="btn btn-default" v-on:click="onSubmitClick($event,file)">提交</button>
            </div>
          </div>

        </div>
      </div>
    </div>
  </div>
</template>

<script src="../../../node_modules/jquery/dist/jquery.min.js"></script>
<script src="../../../node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="../../../node_modules/vue/dist/vue.js"></script>
<script src="../../../node_modules/vue-resource/dist/vue-resource.js"></script>
<script src="node-v1.js"></script>
</body>
</html>
